import React, { useEffect } from 'react';
export function useIntervalJob(times: number, count: number, url?: any) {
  let timer: any = null;
  const fn = () => {
    console.log('轮询请求');
  };
  useEffect(() => {
    timer = setInterval(() => {
      //执行请求
      fn();
      --count;

      if (count === 0) {
        clearInterval(timer);
      }
    }, times);
    return () => {
      clearInterval(timer);
    };
  }, []);
}
